def lengthOfLastWord(s: str) -> int:
    if s == " ":
        return 0

    list_word = s.split(" ")
    if list_word[-1] == "":
        lenth = len(list_word[-2])
    else:
        lenth = len(list_word[-1])
    return lenth

s = "a "
print(lengthOfLastWord(s))